package com.etl.dataflow.scheduler.listener;

import com.etl.dataflow.scheduler.communication.ExecutorStateChecker;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 应用程序启动监听
 *
 * @author dx
 * @since 2022/4/20
 */
@Slf4j
@Component
public class StartupListener implements ApplicationListener<ApplicationStartedEvent> {

    @Resource
    private ExecutorStateChecker executorStateChecker;

    @Override
    public void onApplicationEvent(ApplicationStartedEvent event) {
        // 开始自动刷新执行器状态
        executorStateChecker.startAutoRefreshExecState();
    }
}
